package com.bw.module_car.view

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import com.bw.lib_base.view.BaseActivity
import com.bw.module_car.R
import com.bw.module_car.adpter.RecordAdapter
import com.bw.module_car.databinding.ActivityPayRecordBinding
import com.bw.module_car.viewmodel.CarViewModel
import dagger.hilt.android.AndroidEntryPoint
/**
 * 智慧园区-02-停车记录-v1.1-曲烨-20250509
 */
@AndroidEntryPoint
class PayRecordActivity : BaseActivity<ActivityPayRecordBinding>() {


    private val vm by lazy { ViewModelProvider(this)[CarViewModel::class.java] }
    private lateinit var recordAdapter: RecordAdapter

    override fun initView() {
        super.initView()

        recordAdapter = RecordAdapter()
        mDataBinding.back.setOnClickListener {
            finish()
        }

        mDataBinding.payrecordRv.layoutManager = LinearLayoutManager(this)

        vm.getRecord()
        vm.getRecordSuccess.observe(this){

            recordAdapter.data.addAll(it)
            recordAdapter.notifyDataSetChanged()
        }

        mDataBinding.payrecordRv.adapter = recordAdapter

    }


    override fun getLayoutId(): Int {
        return R.layout.activity_pay_record
    }

}